import { useState } from 'react'
import './App.css'
import { connect } from 'react-redux'
import { doLoginAction } from './store/actions/login'
function App(props) {
  const { login, doLogin } = props
  return (
    <div className="App">
      {!login && <div>未登录 <button onClick={doLogin}>登录</button></div>} 
      {login && <div>已登录</div>} 
    </div>
  )
}
const mapStateToProps = (state) => ({
  login: state.login.login
})
const mapDispatchToProps = () => ({
  doLogin(dispatch) {
    dispatch(doLoginAction())
  }
})
export default connect(mapStateToProps, mapDispatchToProps)(App)
